<template>
  <el-select
    v-model="statementValue"
    @change="statementChange"
    size="mini"
    style="margin-left: 20px"
  >
    <el-option
      v-for="item in statementOptions"
      :key="item.id"
      :label="item.label"
      :value="item.value"
      :disabled="item.disabled"
    >
    </el-option>
  </el-select>
</template>

<script>
export default {
  props: {
    tableColumn: {}, //表头
    dateBin: {}, //日期绑定
  },

  data() {
    return {
      statementOptions: [
        {
          value: "yali",
          label: "压力报表",
        },
        {
          value: "liuliang",
          label: "流量报表",
        },
        {
          value: "shuiliang",
          label: "水量报表",
        },
        {
          value: "shuizhi",
          label: "水质报表",
        },
        {
          value: "dianliang",
          label: "电量报表",
        },
        {
          value: "yewei",
          label: "液位报表",
        },
        {
          value: "yaohao",
          label: "药耗报表",
        },
      ],
      statementValue: "yali", // 报表默认绑定
      staTable: [],
      properties:'',
      interType:'',
    };
  },
  watch: {
    dateBin(newVal) {
      // console.log(newVal);
      if (newVal === 0) {
      } // 日
      else if (newVal === 1) {
      } // 月
      else if (newVal === 2) {
      } // 年
    },
    staTable: {
      handler(newVal) {
        // console.log(newVal);
      },
      deep: true,
    },
  },
  methods: {
    // 报表下拉
    statementChange(label) {
      // console.log(label);
      // 压力报表
      if (label === "yali") {
        // console.log(this.dateBin);
        this.staTable = [
          {
            name: "时间",
            prop: "displayTime",
            type: "",
            id: 1,
          },
          {
            name: "出水压力(Mpa)",
            prop: "das",
            type: "",
            id: 2,
            hm: "(Mpa)",
          },
        ];
        this.properties = "outPressure"
        this.interType = "noQs"
      }
      // 流量报表
      else if (label === "liuliang") {
        this.staTable = [
          {
            name: "时间",
            prop: "displayTime",
            type: "",
            id: 1,
          },
          {
            name: "进水流量（m³/h）",
            prop: "das",
            type: "",
            id: 2,
            hm: "（m³/h）",
          },
          {
            name: "出水流量（m³/h）",
            prop: "das",
            type: "",
            id: 3,
            hm: "（m³/h）",
          },
        ];
        this.properties = "inflow,outflow"
        this.interType = "noQs"
      }
      // 水量报表
      else if (label === "shuiliang") {
        this.staTable = [
          {
            name: "时间",
            prop: "displayTime",
            type: "",
            id: 1,
          },
          {
            name: "原水水量（m³）",
            prop: "das",
            type: "",
            id: 2,
            children: [
              {
                name: "起始读数",
                prop: "das",
                type: "",
                childrenId: 1,
              },
              {
                name: "结束读数",
                prop: "das",
                type: "",
                childrenId: 2,
              },
              {
                name: "累计用量",
                prop: "das",
                type: "",
                childrenId: 3,
              },
            ],
          },
          {
            name: "出水水量（m³）",
            prop: "das",
            type: "",
            id: 3,
            children: [
              {
                name: "起始读数",
                prop: "das",
                type: "",
                childrenId: 1,
              },
              {
                name: "结束读数",
                prop: "das",
                type: "",
                childrenId: 2,
              },
              {
                name: "累计用量",
                prop: "das",
                type: "",
                childrenId: 3,
              },
            ],
          },
        ];
        this.properties = "inflow_total_start,inflow_total_end,inflow_total,outflow_total_start,outflow_total_end,outflow_total"
        this.interType = "haveQs"
      }
      // 水质报表
      else if (label === "shuizhi") {
        this.staTable = [
          {
            name: "时间",
            prop: "displayTime",
            type: "",
            id: 1,
          },
          {
            name: "出水水质",
            prop: "das",
            type: "",
            id: 2,
            children: [
              {
                name: "浊度（NTU）",
                prop: "das",
                type: "",
                childrenId: 1,
              },
              {
                name: "余氯（mg/L）",
                prop: "das",
                type: "",
                childrenId: 2,
              },
              {
                name: "pH",
                prop: "das",
                type: "",
                childrenId: 3,
              },
            ],
          },
          {
            name: "原水水质",
            prop: "das",
            type: "",
            id: 3,
            children: [
              {
                name: "电导率(uS/cm)",
                prop: "das",
                type: "",
                childrenId: 1,
              },
              {
                name: "浊度(NTU)",
                prop: "das",
                type: "",
                childrenId: 2,
              },
              {
                name: "溶解氧(mg/L)",
                prop: "das",
                type: "",
                childrenId: 3,
              },
              {
                name: "pH",
                prop: "das",
                type: "",
                childrenId: 4,
              },
              {
                name: "温度℃",
                prop: "das",
                type: "",
                childrenId: 5,
              },
            ],
          },
        ];
        this.properties = "cleanTurbidity,cleanChlorine,cleanPh,rawSpecificConductance,rawDissolvedOxygen,rawPh,rawTemperature"
        this.interType = "noQs"
      }
      // 电量报表
      else if (label === "dianliang") {
        this.staTable = [];
      }
      // 液位报表
      else if (label === "yewei") {
        this.staTable = [
          {
            name: "时间",
            prop: "displayTime",
            type: "",
            id: 1,
            hm: "（m）",
          },
          {
            name: "原水液位（m）",
            prop: "das",
            type: "",
            id: 2,
            hm: "（m）",
          },
          {
            name: "清水池液位（m）",
            prop: "das",
            type: "",
            id: 3,
            hm: "（m）",
          },
        ];
        this.properties = "rawLevel,cleanLevel"
        this.interType = "noQs"
      }
      // 药耗报表
      else if (label === "yaohao") {
        this.staTable = [
          {
            name: "时间",
            prop: "displayTime",
            type: "",
            id: 1,
          },
          {
            name: "加药量（kg）",
            prop: "das",
            type: "",
            id: 2,
            children: [
              {
                name: "起始读数",
                prop: "das",
                type: "",
                childrenId: 1,
              },
              {
                name: "结束读数",
                prop: "das",
                type: "",
                childrenId: 2,
              },
              {
                name: "累计药耗",
                prop: "das",
                type: "",
                childrenId: 3,
              },
            ],
          },
          {
            name: "加氯量（kg）",
            prop: "das",
            type: "",
            id: 3,
            children: [
              {
                name: "起始读数",
                prop: "das",
                type: "",
                childrenId: 1,
              },
              {
                name: "结束读数",
                prop: "das",
                type: "",
                childrenId: 2,
              },
              {
                name: "累计药耗",
                prop: "das",
                type: "",
                childrenId: 3,
              },
            ],
          },
        ];
        this.properties = "dose_total_start,dose_total_end,dose_total,chlorine_total_start,chlorine_total_end,chlorine_total"
        this.interType = "haveQs"
      }
      // 修改表头
      this.$emit("staChange", {
        staTble: this.staTable,
        staVal: this.statementValue,
        properties:this.properties,
        interType:this.interType
      });
    },
  },
};
</script>

<style lang="scss" scoped></style>
